function search(form)
{

	if (null == form.lat.value || null == form.lng.value
			|| null == form.radius.value)
	{
		alert("please enter valid input, fields can't be blank...");
		return;
	}
	var search = new Object();
	search.lat = form.lat.value;
	search.lng = form.lng.value;
	search.radius = form.radius.value;

	var search_url = "${cs236369.hw5.server.ip}/${project.build.finalName}/restful-services/kml-api/message/"
			+ form.search_kind.value
			+ '/' + form.lat.value 
			+ '/' + form.lng.value 
			+ '/' + form.radius.value;
	//alert(search_url);
	showKml(search_url, form.lat.value, form.lng.value);
}

function showKml(url, lat, lng)
{
	var myLatlng = new google.maps.LatLng(lat, lng);
	var mapOptions =
	{
		zoom : 15,
		center : myLatlng,
		mapTypeId : google.maps.MapTypeId.ROADMAP
	};
	var divMap = document.getElementById('map');
	var map = new google.maps.Map(divMap, mapOptions);
	var georssLayer = new google.maps.KmlLayer(url);
	georssLayer.setMap(map);
}

function getKml(form)
{
	if (null == form.lat.value || null == form.lng.value
			|| null == form.radius.value)
	{
		alert("please enter valid input, fields can't be blank...");
		return;
	}
	var search = new Object();
	search.lat = form.lat.value;
	search.lng = form.lng.value;
	search.radius = form.radius.value;

	var search_url = "${cs236369.hw5.server.ip}/${project.build.finalName}/restful-services/kml-api/message/"
			+ form.search_kind.value
			+ '/' + form.lat.value 
			+ '/' + form.lng.value 
			+ '/' + form.radius.value;
	alert(search_url);
}
